package com.heima.common;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {
    private Long pageIndex;
    private Long pageSize;
    private Long totalPage;
    private Long totalCount;
    private Object currentPageRecords;


    public static <T> Result of(Page<T> page){
        return new Result(page.getCurrent(),page.getSize(),page.getPages(),page.getTotal(),page.getRecords());
    }
}
